package cn.hloger.spider.demo.newsDemo.enums;

/**
 * TODO
 *
 * @author huanglong
 * @Description TODO
 * @data 2022/9/18
 */
public enum LineEnum {
    /**
     * key
     */
    WECHAR("\r\n"),

    /**
     * key
     */
    HTML("<br/>"),
    HTML2("<br>"),

    CHAT("对话编号:"),

    CHAT_REMARK("\r\n%s\r\n========\r\n对话编号:%s"),


    WECHAT_XML("<![CDATA[%s]]>");


    private String code;

    LineEnum(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public static String getChatXml(String content) {
        return String.format(LineEnum.WECHAT_XML.getCode(), content);
    }

    /**
     * 添加对话编号
     * String text = chatResp.getText() + LineEnum.WECHAR.getCode() + LineEnum.CHAT.getCode() + key;
     */
    public static String getChatXmlForCode(String content, int key) {
//        StringBuffer stringBuffer = new StringBuffer();
//        stringBuffer.append(WECHAR.getCode());
//        stringBuffer.append(content);
//        stringBuffer.append(WECHAR.getCode());
//        stringBuffer.append("=========");
//        stringBuffer.append(WECHAR.getCode());
//        stringBuffer.append(CHAT.getCode());
//        stringBuffer.append(key);
//        stringBuffer.append(CHAT_REMARK.getCode());
//        return stringBuffer.toString();
        return String.format(CHAT_REMARK.getCode(), content, key);
    }
}
